```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RabbitMQ消息确认机制深度解析</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.8;
        }
        .header-font {
            font-family: 'Noto Serif SC', serif;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #6B73FF 0%, #000DFF 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .feature-icon {
            width: 60px;
            height: 60px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 12px;
            margin-bottom: 1.5rem;
        }
        .highlight-box {
            border-left: 4px solid #3B82F6;
            background-color: rgba(59, 130, 246, 0.05);
        }
        .first-letter:first-letter {
            font-size: 3em;
            float: left;
            line-height: 0.8;
            margin-right: 0.5rem;
            color: #3B82F6;
            font-weight: bold;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4 sm:px-6 lg:px-8">
        <div class="max-w-5xl mx-auto text-center">
            <h1 class="header-font text-4xl md:text-5xl font-bold mb-6">RabbitMQ消息确认机制</h1>
            <p class="text-xl md:text-2xl opacity-90 mb-8">确保分布式系统中消息可靠传递的核心技术</p>
            <div class="flex justify-center">
                <div class="max-w-3xl bg-white bg-opacity-10 p-6 rounded-lg backdrop-blur-sm">
                    <p class="text-left text-lg leading-relaxed">
                        <span class="first-letter">无</span>论是在大型分布式系统中，还是在微服务架构的应用中，确保消息的可靠传递和处理都是至关重要的。RabbitMQ作为一种广泛应用的消息队列中间件，其消息确认机制在这一过程是最关键的。
                    </p>
                </div>
            </div>
        </div>
    </section>

    <!-- Introduction Section -->
    <section class="py-16 px-4 sm:px-6 lg:px-8">
        <div class="max-w-5xl mx-auto">
            <div class="flex flex-col md:flex-row gap-8">
                <div class="md:w-1/2">
                    <img src="https://cdn.nlark.com/yuque/0/2024/png/21449790/1721115247328-136aa52f-e0e1-4337-8e09-360391913df1.png" alt="RabbitMQ消息队列" class="w-full rounded-lg shadow-lg">
                </div>
                <div class="md:w-1/2">
                    <h2 class="header-font text-3xl font-bold mb-6 text-gray-800">为什么需要消息确认机制？</h2>
                    <p class="text-gray-700 mb-6">
                        在一个电商平台中，用户的订单、支付信息以及库存更新等操作都是通过消息队列来传递的。如果在传输过程中消息丢失，系统将面临数据不一致、订单处理失败甚至是客户投诉等严重问题。
                    </p>
                    <p class="text-gray-700">
                        这就好比是邮递员在送信过程中把信件弄丢了，给我们的生活带来了很多不便。因此，我们需要一种可靠的机制来确保每一条消息都能够被准确地传递和处理。
                    </p>
                </div>
            </div>
        </div>
    </section>

    <!-- Importance Section -->
    <section class="py-16 bg-white px-4 sm:px-6 lg:px-8">
        <div class="max-w-5xl mx-auto">
            <div class="text-center mb-12">
                <h2 class="header-font text-3xl font-bold text-gray-800 mb-4">消息确认机制的重要性</h2>
                <p class="text-gray-600 max-w-3xl mx-auto">
                    消息确认机制在RabbitMQ及其他消息队列系统中扮演着至关重要的角色，确保消息在传递和处理过程中的可靠性和一致性。
                </p>
            </div>

            <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
                <!-- Feature 1 -->
                <div class="bg-gray-50 p-6 rounded-xl card-hover">
                    <div class="feature-icon bg-blue-100 text-blue-600">
                        <i class="fas fa-shield-alt text-2xl"></i>
                    </div>
                    <h3 class="header-font text-xl font-bold mb-3 text-gray-800">保证消息传递的可靠性</h3>
                    <p class="text-gray-700">
                        通过生产者确认和消费者确认，确保消息在整个传递过程中不会丢失。即使在网络中断或服务器故障的情况下，也能保证消息的可靠传递。
                    </p>
                </div>

                <!-- Feature 2 -->
                <div class="bg-gray-50 p-6 rounded-xl card-hover">
                    <div class="feature-icon bg-green-100 text-green-600">
                        <i class="fas fa-database text-2xl"></i>
                    </div>
                    <h3 class="header-font text-xl font-bold mb-3 text-gray-800">确保数据一致性</h3>
                    <p class="text-gray-700">
                        在分布式系统中，消息确认机制通过确保每条消息的准确传递和处理，维护了系统的整体一致性，特别是在跨服务的事务性操作中至关重要。
                    </p>
                </div>

                <!-- Feature 3 -->
                <div class="bg-gray-50 p-6 rounded-xl card-hover">
                    <div class="feature-icon bg-purple-100 text-purple-600">
                        <i class="fas fa-heartbeat text-2xl"></i>
                    </div>
                    <h3 class="header-font text-xl font-bold mb-3 text-gray-800">提高系统的可用性</h3>
                    <p class="text-gray-700">
                        通过消息重传机制和死信队列(DLQ)，确保即使某个消费者故障，消息依然能够被其他消费者处理，从而保证了系统的高可用性。
                    </p>
                </div>

                <!-- Feature 4 -->
                <div class="bg-gray-50 p-6 rounded-xl card-hover">
                    <div class="feature-icon bg-yellow-100 text-yellow-600">
                        <i class="fas fa-expand-arrows-alt text-2xl"></i>
                    </div>
                    <h3 class="header-font text-xl font-bold mb-3 text-gray-800">支持系统扩展性</h3>
                    <p class="text-gray-700">
                        RabbitMQ提供了单条确认、批量确认和异步确认等多种确认模式，开发者可以根据业务需求选择合适的确认方式，以平衡可靠性和性能。
                    </p>
                </div>
            </div>
        </div>
    </section>

    <!-- Roles Section -->
    <section class="py-16 px-4 sm:px-6 lg:px-8">
        <div class="max-w-5xl mx-auto">
            <div class="text-center mb-12">
                <h2 class="header-font text-3xl font-bold text-gray-800 mb-4">消息确认的角色</h2>
                <p class="text-gray-600 max-w-3xl mx-auto">
                    在RabbitMQ的消息确认机制中，主要涉及三个关键角色：生产者、RabbitMQ服务器（Broker），以及消费者。
                </p>
            </div>

            <div class="mb-12">
                <img src="https://cdn.nlark.com/yuque/0/2024/png/21449790/1721115296275-185eeb10-1053-4ee6-9d26-2d76300702bb.png" alt="RabbitMQ消息确认角色" class="w-full rounded-lg shadow-lg">
            </div>

            <div class="grid grid-cols-1 md:grid-cols-3 gap-8">
                <!-- Producer -->
                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="flex items-center mb-4">
                        <div class="bg-blue-500 text-white p-3 rounded-full mr-4">
                            <i class="fas fa-paper-plane text-xl"></i>
                        </div>
                        <h3 class="header-font text-xl font-bold text-gray-800">生产者 (Producer)</h3>
                    </div>
                    <p class="text-gray-700 mb-4">
                        生产者是消息的发送方，负责将消息发送到RabbitMQ服务器。需要实现消息确认机制确保消息可靠传递。
                    </p>
                    <div class="highlight-box p-4 mb-4">
                        <h4 class="font-bold text-gray-800 mb-2">主要职责：</h4>
                        <ul class="list-disc pl-5 text-gray-700 space-y-1">
                            <li>消息发布确认（同步/异步）</li>
                            <li>处理确认回调</li>
                            <li>实现重传机制</li>
                        </ul>
                    </div>
                </div>

                <!-- Broker -->
                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="flex items-center mb-4">
                        <div class="bg-green-500 text-white p-3 rounded-full mr-4">
                            <i class="fas fa-server text-xl"></i>
                        </div>
                        <h3 class="header-font text-xl font-bold text-gray-800">RabbitMQ服务器 (Broker)</h3>
                    </div>
                    <p class="text-gray-700 mb-4">
                        作为消息队列的核心，负责接收、存储和分发消息，确保消息的可靠传递。
                    </p>
                    <div class="highlight-box p-4 mb-4">
                        <h4 class="font-bold text-gray-800 mb-2">主要职责：</h4>
                        <ul class="list-disc pl-5 text-gray-700 space-y-1">
                            <li>消息持久化存储</li>
                            <li>向生产者发送确认</li>
                            <li>处理消费者确认</li>
                        </ul>
                    </div>
                </div>

                <!-- Consumer -->
                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="flex items-center mb-4">
                        <div class="bg-purple-500 text-white p-3 rounded-full mr-4">
                            <i class="fas fa-user-check text-xl"></i>
                        </div>
                        <h3 class="header-font text-xl font-bold text-gray-800">消费者 (Consumer)</h3>
                    </div>
                    <p class="text-gray-700 mb-4">
                        消息的接收方，负责从RabbitMQ获取并处理消息，通过确认机制确保消息被正确处理。
                    </p>
                    <div class="highlight-box p-4 mb-4">
                        <h4 class="font-bold text-gray-800 mb-2">主要职责：</h4>
                        <ul class="list-disc pl-5 text-gray-700 space-y-1">
                            <li>自动确认模式</li>
                            <li>手动确认模式</li>
                            <li>消息重传处理</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Producer Confirms Section -->
    <section class="py-16 bg-white px-4 sm:px-6 lg:px-8">
        <div class="max-w-5xl mx-auto">
            <div class="text-center mb-12">
                <h2 class="header-font text-3xl font-bold text-gray-800 mb-4">Producer消息确认机制</h2>
                <p class="text-gray-600 max-w-3xl mx-auto">
                    确保消息从生产者成功发送到RabbitMQ队列的关键机制
                </p>
            </div>

            <div class="mb-12">
                <div class="bg-blue-50 p-6 rounded-xl">
                    <h3 class="header-font text-xl font-bold text-gray-800 mb-4">确认模式</h3>
                    <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                        <div class="bg-white p-4 rounded-lg shadow-sm">
                            <h4 class="font-bold text-blue-600 mb-2">单条确认</h4>
                            <p class="text-gray-700 text-sm">
                                生产者在发送每条消息后，等待RabbitMQ的确认。可靠性高但性能较低。
                            </p>
                        </div>
                        <div class="bg-white p-4 rounded-lg shadow-sm">
                            <h4 class="font-bold text-blue-600 mb-2">批量确认</h4>
                            <p class="text-gray-700 text-sm">
                                生产者一次性发送一批消息，然后等待RabbitMQ对该批消息的确认。
                            </p>
                        </div>
                        <div class="bg-white p-4 rounded-lg shadow-sm">
                            <h4 class="font-bold text-blue-600 mb-2">异步确认</h4>
                            <p class="text-gray-700 text-sm">
                                生产者在发送消息后不等待确认，而是通过回调函数处理RabbitMQ的确认消息。
                            </p>
                        </div>
                    </div>
                </div>
            </div>

            <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
                <div>
                    <h3 class="header-font text-xl font-bold text-gray-800 mb-4">Return机制</h3>
                    <p class="text-gray-700 mb-4">
                        RabbitMQ的Return机制用于处理消息在发送过程中未能路由到任何队列的情况。
                    </p>
                    <div class="highlight-box p-4 mb-4">
                        <h4 class="font-bold text-gray-800 mb-2">触发条件：</h4>
                        <ul class="list-disc pl-5 text-gray-700 space-y-1">
                            <li>消息被拒绝（basic.reject或basic.nack）</li>
                            <li>超过最大重试次数</li>
                            <li>TTL（Time-To-Live）过期</li>
                        </ul>
                    </div>
                </div>

                <div>
                    <h3 class="header-font text-xl font-bold text-gray-800 mb-4">代码示例</h3>
                    <div class="bg-gray-800 rounded-lg overflow-hidden">
                        <div class="bg-gray-700 px-4 py-2 flex items-center">
                            <div class="flex space-x-2">
                                <div class="w-3 h-3 rounded-full bg-red-500"></div>
                                <div class="w-3 h-3 rounded-full bg-yellow-500"></div>
                                <div class="w-3 h-3 rounded-full bg-green-500"></div>
                            </div>
                            <div class="text-white text-sm ml-4">Java - 生产者确认</div>
                        </div>
                        <div class="p-4 text-gray-100 font-mono text-sm overflow-x-auto">
                            <pre><code>channel.addConfirmListener(new ConfirmListener() {
    @Override
    public void handleAck(long deliveryTag, boolean multiple) {
        // 处理确认消息
        System.out.println("Message confirmed: " + deliveryTag);
    }

    @Override
    public void handleNack(long deliveryTag, boolean multiple) {
        // 处理未确认消息
        System.out.println("Message not confirmed: " + deliveryTag);
    }
});

// 发送消息
channel.basicPublish(exchange, routingKey, null, message.getBytes());</code></pre>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Consumer Confirms Section -->
    <section class="py-16 px-4 sm:px-6 lg:px-8">
        <div class="max-w-5xl mx-auto">
            <div class="text-center mb-12">
                <h2 class="header-font text-3xl font-bold text-gray-800 mb-4">Consumer消息确认机制</h2>
                <p class="text-gray-600 max-w-3xl mx-auto">
                    确保消息被成功处理的重要特性
                </p>
            </div>

            <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-12">
                <div>
                    <h3 class="header-font text-xl font-bold text-gray-800 mb-4">确认模式</h3>
                    <div class="space-y-4">
                        <div class="bg-white p-4 rounded-lg shadow-md">
                            <div class="flex items-center mb-2">
                                <div class="bg-green-500 text-white p-2 rounded-full mr-3">
                                    <i class="fas fa-robot text-sm"></i>
                                </div>
                                <h4 class="font-bold text-gray-800">自动确认（Auto Acknowledgment）</h4>
                            </div>
                            <p class="text-gray-700 text-sm pl-10">
                                消费者在接收消息后，RabbitMQ会立即将该消息视为已被确认。简单但存在消息丢失风险。
                            </p>
                        </div>
                        <div class="bg-white p-4 rounded-lg shadow-md">
                            <div class="flex items-center mb-2">
                                <div class="bg-blue-500 text-white p-2 rounded-full mr-3">
                                    <i class="fas fa-hand-paper text-sm"></i>
                                </div>
                                <h4 class="font-bold text-gray-800">手动确认（Manual Acknowledgment）</h4>
                            </div>
                            <p class="text-gray-700 text-sm pl-10">
                                消费者在成功处理消息后显式地调用basic.ack方法。可靠性高，是推荐的方式。
                            </p>
                        </div>
                    </div>
                </div>
                <div>
                    <div class="bg-gray-800 rounded-lg overflow-hidden h-full">
                        <div class="bg-gray-700 px-4 py-2 flex items-center">
                            <div class="flex space-x-2">
                                <div class="w-3 h-3 rounded-full bg-red-500"></div>
                                <div class="w-3 h-3 rounded-full bg-yellow-500"></div>
                                <div class="w-3 h-3 rounded-full bg-green-500"></div>
                            </div>
                            <div class="text-white text-sm ml-4">Java - 消费者确认</div>
                        </div>
                        <div class="p-4 text-gray-100 font-mono text-sm overflow-x-auto">
                            <pre><code>DeliverCallback deliverCallback = (consumerTag, delivery) -> {
    String message = new String(delivery.getBody());
    try {
        // 处理消息
        System.out.println("Received: " + message);
        
        // 手动确认
        channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false);
    } catch (Exception e) {
        // 处理异常，可选择重新入队
        channel.basicNack(delivery.getEnvelope().getDeliveryTag(), false, true);
    }
};

channel.basicConsume(queueName, false, deliverCallback, consumerTag -> {});</code></pre>
                        </div>
                    </div>
                </div>
            </div>

            <h3 class="header-font text-xl font-bold text-gray-800 mb-4">消息重传和死信队列(DLQ)</h3>
            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                <div class="bg-indigo-50 p-6 rounded-lg">
                    <h4 class="font-bold text-indigo-700 mb-3">消息重传机制</h4>
                    <p class="text-gray-700 mb-3">
                        消费者处理失败时，系统将消息重新放回队列，供后续再次尝试处理。通常通过手动确认和未确认消息的重新投递实现。
                    </p>
                    <div class="bg-white p-3 rounded text-sm">
                        <p class="text-gray-700 font-mono">
                            channel.basicNack(deliveryTag, false, true); // 重新入队
                        </p>
                    </div>
                </div>
                <div class="bg-purple-50 p-6 rounded-lg">
                    <h4 class="font-bold text-purple-700 mb-3">死信队列(DLQ)</h4>
                    <p class="text-gray-700 mb-3">
                        专门存储处理失败的消息的队列。当消息达到最大重试次数或被拒绝时，会被发送到DLQ，便于进一步分析和处理。
                    </p>
                    <div class="bg-white p-3 rounded text-sm">
                        <p class="text-gray-700">
                            <span class="font-bold">触发条件：</span> 消息被拒绝、超过重试次数、TTL过期
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Transaction vs Confirms Section -->
    <section class="py-16 bg-white px-4 sm:px-6 lg:px-8">
        <div class="max-w-5xl mx-auto">
            <div class="text-center mb-12">
                <h2 class="header-font text-3xl font-bold text-gray-800 mb-4">事务机制与消息确认机制的对比</h2>
                <p class="text-gray-600 max-w-3xl mx-auto">
                    两种确保消息处理可靠性的不同方法
                </p>
            </div>

            <div class="overflow-x-auto">
                <table class="min-w-full bg-white rounded-lg overflow-hidden">
                    <thead class="bg-gray-100">
                        <tr>
                            <th class="py-3 px-4 text-left text-gray-700 font-bold">特性</th>
                            <th class="py-3 px-4 text-left text-gray-700 font-bold">事务机制</th>
                            <th class="py-3 px-4 text-left text-gray-700 font-bold">消息确认机制</th>
                        </tr>
                    </thead>
                    <tbody class="divide-y divide-gray-200">
                        <tr>
                            <td class="py-4 px-4 text-gray-700 font-medium">定义</td>
                            <td class="py-4 px-4 text-gray-600">确保一组操作要么全部成功，要么全部失败</td>
                            <td class="py-4 px-4 text-gray-600">确保消息从生产者到队列的传递可靠性</td>
                        </tr>
                        <tr class="bg-gray-50">
                            <td class="py-4 px-4 text-gray-700 font-medium">使用场景</td>
                            <td class="py-4 px-4 text-gray-600">对原子性要求高的场景，如银行转账</td>
                            <td class="py-4 px-4 text-gray-600">需要保证消息送达和处理的场景，如日志处理</td>
                        </tr>
                        <tr>
                            <td class="py-4 px-4 text-gray-700 font-medium">性能</td>
                            <td class="py-4 px-4 text-gray-600">较高开销，降低吞吐量</td>
                            <td class="py-4 px-4 text-gray-600">影响较小，特别是异步确认</td>
                        </tr>
                        <tr class="bg-gray-50">
                            <td class="py-4 px-4 text-gray-700 font-medium">错误处理</td>
                            <td class="py-4 px-4 text-gray-600">通过回滚恢复事务前状态</td>
                            <td class="py-4 px-4 text-gray-600">消息重新投递或进入死信队列</td>
                        </tr>
                        <tr>
                            <td class="py-4 px-4 text-gray-700 font-medium">实现复杂度</td>
                            <td class="py-4 px-4 text-gray-600">较高</td>
                            <td class="py-4 px-4 text-gray-600">相对简单</td>
                        </tr>
                    </tbody>
                </table>
            </div>

            <div class="mt-12 bg-blue-50 p-6 rounded-xl">
                <h3 class="header-font text-xl font-bold text-gray-800 mb-4">最佳实践建议</h3>
                <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                    <div>
                        <h4 class="font-bold text-blue-700 mb-2">使用事务机制：</h4>
                        <ul class="list-disc pl-5 text-gray-700 space-y-1">
                            <li>需要严格原子性保证的场景</li>
                            <li>消息发送与其他操作需要一致性</li>
                            <li>可以接受性能下降的情况</li>
                        </ul>
                    </div>
                    <div>
                        <h4 class="font-bold text-blue-700 mb-2">使用确认机制：</h4>
                        <ul class="list-disc pl-5 text-gray-700 space-y-1">
                            <li>高吞吐量要求的场景</li>
                            <li>不需要严格事务语义的场景</li>
                            <li>需要灵活错误处理的系统</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Process Diagram -->
    <section class="py-16 px-4 sm:px-6 lg:px-8">
        <div class="max-w-5xl mx-auto">
            <div class="text-center mb-12">
                <h2 class="header-font text-3xl font-bold text-gray-800 mb-4">RabbitMQ消息确认流程</h2>
                <p class="text-gray-600 max-w-3xl mx-auto">
                    可视化展示消息在生产者、RabbitMQ和消费者之间的确认流程
                </p>
            </div>

            <div class="mermaid">
                sequenceDiagram
                    participant Producer
                    participant RabbitMQ
                    participant Consumer

                    Producer->>RabbitMQ: 发送消息
                    RabbitMQ-->>Producer: 确认收到(ACK)
                    RabbitMQ->>Consumer: 分发消息
                    Consumer->>RabbitMQ: 处理完成(ACK)
                    RabbitMQ->>RabbitMQ: 删除消息

                    alt 处理失败
                        Consumer->>RabbitMQ: NACK/Reject
                        RabbitMQ->>Consumer: 重新投递
                    end
            </div>
        </div>
    </section>

    <!-- Summary Section -->
    <section class="py-16 bg-gray-50 px-4 sm:px-6 lg:px-8">
        <div class="max-w-5xl mx-auto">
            <div class="bg-white p-8 rounded-xl shadow-lg">
                <h2 class="header-font text-3xl font-bold text-center text-gray-800 mb-8">关键要点总结</h2>
                <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
                    <div>
                        <div class="flex items-start mb-4">
                            <div class="bg-blue-100 p-2 rounded-full mr-4">
                                <i class="fas fa-check-circle text-blue-600"></i>
                            </div>
                            <div>
                                <h3 class="font-bold text-gray-800 mb-2">生产者确认机制</h3>
                                <p class="text-gray-700">
                                    确保消息从生产者可靠传递到RabbitMQ，支持单条、批量和异步确认模式。
                                </p>
                            </div>
                        </div>
                        <div class="flex items-start mb-4">
                            <div class="bg-green-100 p-2 rounded-full mr-4">
                                <i class="fas fa-check-circle text-green-600"></i>
                            </div>
                            <div>
                                <h3 class="font-bold text-gray-800 mb-2">消费者确认机制</h3>
                                <p class="text-gray-700">
                                    手动确认模式是保证消息可靠处理的最佳实践，支持消息重传和错误处理。
                                </p>
                            </div>
                        </div>
                    </div>
                    <div>
                        <div class="flex items-start mb-4">
                            <div class="bg-purple-100 p-2 rounded-full mr-4">
                                <i class="fas fa-check-circle text-purple-600"></i>
                            </div>
                            <div>
                                <h3 class="font-bold text-gray-800 mb-2">死信队列(DLQ)</h3>
                                <p class="text-gray-700">
                                    处理无法正常消费的消息，为系统提供故障处理和监控能力。
                                </p>
                            </div>
                        </div>
                        <div class="flex items-start">
                            <div class="bg-yellow-100 p-2 rounded-full mr-4">
                                <i class="fas fa-check-circle text-yellow-600"></i>
                            </div>
                            <div>
                                <h3 class="font-bold text-gray-800 mb-2">确认机制选择</h3>
                                <p class="text-gray-700">
                                    根据业务需求在可靠性和性能之间取得平衡，通常优先选择确认机制而非事务。
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-12 px-4 sm:px-6 lg:px-8">
        <div class="max-w-5xl mx-auto">
            <div class="flex flex-col items-center">
                <div class="text-xl font-bold mb-4">技术小馆</div>
                <a href="http://www.yuque.com/jtostring" class="text-gray-400 hover:text-white transition-colors duration-200">http://www.yuque.com/jtostring</a>
            </div>
            <div class="mt-8 pt-8 border-t border-gray-800 text-center text-gray-500 text-sm">
                &copy; 2024 技术小馆. All rights reserved.
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```